package com.daifeng.gulimall.product.feign;


import com.daifeng.common.to.SkuReductionTo;
import com.daifeng.common.to.SpuBoundsTo;
import com.daifeng.common.utils.R;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

//  服务降级 如果服务器停止时候  有请求进来 就会走这里
@Component
public class CouponServiceFallbackFactory implements FallbackFactory {

    @Override
    public CouponServiceFeign create(Throwable cause) {
        return new CouponServiceFeign() {  //对应feigh的接口类

            /**
             * 这个的路径要对应mall-coupon服务的全路径
             *
             * @param spuBounds
             */
            @Override
            public R save(SpuBoundsTo spuBounds) {
                return null;
            }

            @Override
            public R saveSkuReduction(SkuReductionTo skuReductionTo) {
                return null;
            }
        };
    }

}
